from bs4 import BeautifulSoup
htmlString="""
<html>
<head><title>My Document</title></head>
<body>
main text
</body>
</html>
"""

soup=BeautifulSoup(htmlString,features="html.parser")
print("#"*20)
print(soup.get_text())
print("#"*20)
print(soup.prettify())
print("#"*20)